Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trait bounds to reject invalid Writers #162

Merged
merged 30 commits into from
Nov 19, 2021
Merged

Add trait bounds to reject invalid Writers #162

merged 30 commits into from
Nov 19, 2021

Conversation

ilslv
Copy link
Member

@ilslv ilslv commented Nov 16, 2021

Synopsis

For now it's possible to misconfigure Writer and get runtime panic!.

Solution

Add trait bounds to reject invalid Writers on type level, when creating from API.

Checklist

  • Created PR:
    • In draft mode
    • Name contains Draft: prefix
    • Name contains issue reference
    • Has assignee
  • Documentation is updated (if required)
  • Tests are updated (if required)
  • Changes conform code style
  • CHANGELOG entry is added (if required)
  • FCM (final commit message) is posted
    • and approved
  • Review is completed and changes are approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • Draft: prefix is removed
    • All temporary labels are removed

@ilslv ilslv added the enhancement Improvement of existing features or bugfix label Nov 16, 2021
@ilslv ilslv added this to the 0.11 milestone Nov 16, 2021
@ilslv ilslv self-assigned this Nov 16, 2021
ilslv and others added 18 commits November 16, 2021 14:45
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	book/src/Features.md
#	src/cucumber.rs
#	src/writer/basic.rs
#	src/writer/mod.rs
#	src/writer/normalize.rs
#	src/writer/tee.rs
# Conflicts:
#	CHANGELOG.md
#	book/src/Features.md
#	src/writer/json.rs
#	src/writer/mod.rs
#	src/writer/normalize.rs
#	src/writer/tee.rs
@ilslv ilslv changed the title Draft: Require Writer in Cucumber to be Normalized Draft: Add trait bounds to reject invalid Writers Nov 18, 2021
@ilslv
Copy link
Member Author

ilslv commented Nov 18, 2021

FCM

Add trait bounds to reject invalid `Writer`s pipelines (#162)

- rename `Normalized` and `Summarized` `Writer`s to `Normalize` and `Summarize`
- add `Normalized` trait and require it for `Writer`s in `Cucumber` run methods
- add `NonTransforming` trait and require it for `writer::Repeat`
- add `Summarizable` trait and require it for `writer::Summarize`

@ilslv ilslv marked this pull request as ready for review November 18, 2021 09:40
@ilslv ilslv changed the title Draft: Add trait bounds to reject invalid Writers Add trait bounds to reject invalid Writers Nov 18, 2021
@ilslv ilslv requested a review from tyranron November 18, 2021 10:23
Copy link
Member

@tyranron tyranron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@tyranron tyranron merged commit f97d0a3 into main Nov 19, 2021
@tyranron tyranron deleted the typesafe-writers branch November 19, 2021 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement of existing features or bugfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants